<template>
  <Portlet>
    <table class="order-table">
      <tr v-for="(item, index) in fhbOrderBiddingLogs" :key="index">
        <td align="center" style="padding-left: 5px; width: 180px">
          <img :src="'/api/ms-mongodb/file/download?fileId=' + item.businessImg" style="width: 150px; height: 150px; border-radius: 50%"/>
        </td>
        <td>
          <div class="marginBottom8">
            {{item.name}}
            <el-tooltip v-if="item.isAuthention == 1" class="item" effect="dark" content="已通过实名认证" placement="top-start">
              <img style="no-repeat: center; height: 16px; width: 20px" src="/static/images/faHuoBao/certification.png" alt="实名认证" title="已通过实名认证" />
            </el-tooltip>
            <el-tooltip v-if="item.isAuthention !== 1" class="item" effect="dark" content="未实名认证" placement="top-start">
              <img style="no-repeat: center; height: 16px; width: 20px" src="/static/images/faHuoBao/Unproven.png" alt="未实名认证" title="未实名认证"/>
            </el-tooltip>
            <el-tooltip class="item" effect="dark" :content="carContent(item.cars, item.carsHold)" placement="top-start" style="margin-top: 5px">
              <img style="no-repeat: center; height: 14px; width: 20px" src="/static/images/faHuoBao/car.png" alt="车辆" :title="carContent(item.cars, item.carsHold)" />
            </el-tooltip>
            <el-tooltip class="item" effect="dark" :content="areaContent(item.area)" placement="top-start">
              <img style="no-repeat: center; height: 16px; width: 20px" src="/static/images/faHuoBao/warehouse.png" alt="仓库" :title="areaContent(item.area)" />
            </el-tooltip>
          </div>
          <div class="marginBottom8">
            <span class="shiFuAddress">{{item.nature}}</span><span v-if="item.address"> | {{item.address}} </span>
          </div>
          <div class="marginBottom8">
            <el-tooltip v-if="item.favorTMJD == 1" class="item" effect="dark" content="支持汪师傅核销" placement="right">
              <img style="no-repeat: center; height: 22px; width: 46px" src="/static/images/faHuoBao/wangshifu.png" alt="汪师傅" title="支持汪师傅核销" />
            </el-tooltip>
            <el-tooltip v-if="item.favorTMJD == 1" class="item" effect="dark" content="支持喵师傅核销" placement="right">
              <img style="no-repeat: center; height: 22px; width: 46px" src="/static/images/faHuoBao/miaoshifu.png" alt="喵师傅" title="支持喵师傅核销" />
            </el-tooltip>
          </div>
          <div class="marginBottom8">
            <span>好评率：{{item.evalueGoods}}%</span><span style="margin-left: 20px;">总单数：{{item.orderSucessCount}}</span><span style="margin-left: 20px;">投诉数：{{item.complaintCount}}</span>
          </div>
          <div>
            <span>{{item.label}}</span>
            <span>报价时间：{{item.biddingDate|unixTimestampFilter}}</span>
          </div>
        </td>
        <td align="center">
          <div class="cell-center">
            <p>师傅报价</p>
            <p><span style="font-size: 36px;" class="font-red">￥{{item.money}}</span></p>
            <span v-if="item.memo">留言：<truncate :value="item.memo" :maxLength="12"></truncate></span>
          </div>
        </td>
        <td align="center">
          <div class="cell-center">
            <img v-if="item.isBidding == 1" style="no-repeat: center; height: 80px; width: 80px" src="/static/images/faHuoBao/bidding.png" alt="中标" title="中标" />
            <el-button v-if="item.isBidding != 1 && isFhbStayPayWeb"  class="btn gray Fa-t-right" @click="sumbitWinBidding(item.fhbOrderId, item.id)">中标</el-button>
          </div>
        </td>
      </tr>
    </table>
  </Portlet>
</template>

<script>
import {dotData} from '@/utils'
export default {
  name: 'bidding-log',
  props: {
    orderDetail: {
      type: Object,
      default() {
        return {}
      }
    }
  },
  components: {
  },
  data() {
    return {
      isFhbAdminPath: -1,
      biddingId: '',
      biddingPayId: ''
    }
  },
  computed: {
    fhbOrderBiddingLogs() {
      return dotData(this.orderDetail, 'fhbOrderBiddingLogs') || []
    },
    // 在：代付款的报价记录 + 而且是发货宝项目里，才能修改中标师傅
    isFhbStayPayWeb() {
      let orderState = dotData(this.orderDetail, 'fhbOrder.orderStatus')
      if (orderState === 'stayPay|100') {
        return true
      } else {
        return false
      }
    }
  },
  methods: {
    carContent(num, carsHold) {
      if (carsHold) {
        return '配送车辆：' + num + '辆'
      } else {
        return '配送车辆： 0 辆'
      }
    },
    areaContent(num) {
      return '仓库：' + num + '㎡'
    },
    // 修改中标师傅
    sumbitWinBidding(fhbOrderId, id) {
      this.biddingId = fhbOrderId
      this.biddingPayId = id
      // this.isShowModifyModal = true
    }
  }
}
</script>

<style scoped>

</style>
